package com.dogkr.server.web.guest;

import java.util.Date;
import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.ResultPath;
import org.apache.struts2.convention.annotation.Results;
import org.springframework.beans.factory.annotation.Autowired;
import com.dogkr.common.ServerAction;
import com.dogkr.server.entity.Host;
import com.dogkr.server.entity.HostPhoto;
import com.dogkr.server.mapper.HostPhotoAlbumMapper;
import com.dogkr.server.mapper.HostPhotoMapper;
import com.dogkr.server.service.HostService;
import com.dogkr.server.service.PhotoService;
import com.sean.common.page.ResultPagination;
import com.sean.common.utils.DateUtils;
import com.sean.common.utils.StringUtils;

// 设置Struts2注解
@ParentPackage(value = "project-default")
@Namespace(value = "/search")
@ResultPath("/WEB-INF/jsps")
// 页面文件空间
@Results({
	
})
public class SearchAction extends ServerAction {
	
	private static final long serialVersionUID = 1L;
	
	@Autowired
	private HostService hostService;
	@Autowired
	private PhotoService photoService;
	
	private String word;
	
	@Action(value="host")
	public void host() {
		if(StringUtils.isBlank(word)) {
			outJson(new ResultPagination<Host>());
		}
		outJson(hostService.selectWithSearch(this.getPaginationForParameter(), word));
	}
	
	@Action(value="gethost")
	public void getHost() {
		outJson(hostService.selectByIdWithAll(id));
	}

	public String getWord() {
		return word;
	}

	public void setWord(String word) {
		this.word = word;
	}
}
